<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <script src="../lib/vue.js"></script>
  </head>

  <body>
    <!--1.插槽的基本使用 <slot></slot>
        2.插槽的默认值 <slot><button>按钮</button></slot>
        3.如果有多个值,同时放入组件中进行替换，会一起生效。
    -->
    <div id="app">
      <cpn></cpn>
      <hr />
      <cpn
        ><span>11</span>
        <div>我是div元素</div></cpn
      >
      <hr />
      <cpn><i>hhehe</i></cpn>
      <hr />
      <cpn></cpn>
    </div>

    <template id="cpn">
      <div>
        <h2>我是组件</h2>
        <h2>我是组件内容，哈哈哈</h2>
        <slot><button>按钮</button></slot>
      </div>
    </template>

    <script>
      var vm = new Vue({
        el: '#app',
        data: {},
        methods: {},
        components: {
          cpn: {
            template: '#cpn'
          }
        }
      });
    </script>
  </body>
</html>
